<?php
namespace app\admin\controller;
use app\admin\logic\LoginLogic;
use app\admin\util\Response;

class Login extends Base
{
    public function index()
    {
        if(Base::get_admin_info()){
            $this->redirect(url('index/index'));
        }else{
            return view();
        }

    }
    public function login($user_name = '',$pass_word = '',$verify_code = ''){
        if($this->_ajax){
            $param = [];
            $param['user_name'] = $user_name;
            $param['pass_word'] = $pass_word;
            $param['verify_code'] = $verify_code;
            $logic = new LoginLogic($param);
            $logic->login();
            if($logic->result === false){
                Response::json($logic->err['code'],$logic->err['msg']);
            }else{
                Response::json();
            }
        }else{
            $this->redirect(url('index'));
        }
    }
}
